package com.hitechbangla.fctu.base;

import com.hitechbangla.fctu.base.aircraft.Aircraft;
import com.hitechbangla.fctu.base.aircraft.AircraftType;
import com.hitechbangla.fctu.base.base.Base;
import com.hitechbangla.fctu.base.base.BaseType;
import com.hitechbangla.fctu.base.base.Gbad;
import com.hitechbangla.fctu.base.base.GbadType;
import com.hitechbangla.fctu.base.base.Kpi;
import com.hitechbangla.fctu.base.map.FCTUMap;
import com.hitechbangla.fctu.base.map.MapType;
import com.hitechbangla.fctu.base.radar.Radar;
import com.hitechbangla.fctu.base.radar.RadarType;
import com.hitechbangla.fctu.base.weather.Cloud;
import com.hitechbangla.fctu.base.weather.RandomCloud;
import com.hitechbangla.fctu.base.weather.WindLayer;
import com.hitechbangla.fctu.base.weather.Wind;
import com.hitechbangla.fctu.utility.MultipleAircraft;
import fctu.simulator.HTB_MAIN;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author deb kanti
 */
public class GameScene implements Serializable 
{   
    public transient HTB_MAIN HTBParent;
    //public  HTB_MAIN HTBParent;
    public List<Aircraft> airCraftList;
    public List<Radar> radarList;
    public List<Integer> selectedMapIndices;
    
    public List<Gbad> gbadList;
    public List<AircraftType> airCraftTypeList;
    public List<RadarType> radarTypeList;
    public List<BaseType> baseTypeList;
    public List<GbadType> gbadTypeList; 
    public List<FCTUMap> maps;
    public List<Base> baseList;
    public List<Wind> windList;
    public List<Wind> windSystemList;
    public List<Kpi> kList;
    public List<Cloud> cloudList;
    public List<RandomCloud> cloudSystemList;
    
    public static int rectSize = 5;
    public String userName = "";
   
    public List<MultipleAircraft> macList;
    
    public GameScene() 
    {
	airCraftList = new LinkedList<Aircraft>();
	radarList = new LinkedList<Radar>();
	selectedMapIndices = new LinkedList<Integer>();
	windSystemList = new ArrayList<>();
        cloudSystemList = new ArrayList<>();        
        
        macList= new LinkedList<MultipleAircraft>();
	//List<Base> 
	//List<KPI>
        gbadTypeList = GbadType.getAllGbadTypes();
	airCraftTypeList = AircraftType.getAllAircraftType();
	baseTypeList = BaseType.getAllBaseTypes();
	radarTypeList = RadarType.getAllRadarType();
        maps = MapType.deserialzeAddress();
	baseList = new ArrayList<>();
        kList = new ArrayList<>();
        gbadList = new ArrayList<>();
        ////System.out.println("from gamescene" + (baseTypeList == null? true : false));
	windList = Wind.getAllWind();
	cloudList = Cloud.getAllCloud();
        //maps = FCTUMap.getMap();
	
    }//end of constructor
    
    public String[] getRadarStringArray()
    {
	String[] retVal = new String[radarList.size()];
	
	int index = 0;
	
	for(Radar type : radarList)
	{	    
	    retVal[index] = type.getRadarState().getRadarName();
	    index++;
	}//end for	
	
	return retVal;
    }
    
    
    public String[] getAirCraftStringArray(){
	String[] retVal = new String[airCraftList.size()];
	int index = 0;
	for(Aircraft type : airCraftList){
	    retVal[index] = type.getAircraftState().getCallSign();
	    index++;
	}//end for	
	return retVal;
    }
    
    public String[] getAirCraftTypeStringArray(){
	String[] retVal = new String[airCraftTypeList.size()];
	int index = 0;
	for(AircraftType type : airCraftTypeList){
	    retVal[index] = type.getTypename();
	    index++;
	}//end for	
	return retVal;
    }//end of get radar type
    
    public String[] getBaseListStringArray(){
	if(baseList.size() == 0){
	    return new String[]{""};
	}
	String[] retVal = new String[baseList.size()];
	int index = 0;
	for(Base type : baseList){
	    retVal[index] = type.getBaseType().getName();
	    index++;
	}//end for	
	//System.out.println("Game Scene : base List size " + baseList.size());
	return retVal;
    }//end of get radar type
    
    public String[] getBaseTypeStringArray(){
	String[] retVal = new String[baseTypeList.size()];
	int index = 0;
	for(BaseType type : baseTypeList){
	    retVal[index] = type.getName();
	    index++;
	}//end for	
	return retVal;
    }//end of get radar type
    
    public String[] getRadarTypeStringArray(){
	String[] retVal = new String[radarTypeList.size()];
	int index = 0;
	for(RadarType type : radarTypeList){
	    retVal[index] = type.getRadarType();
	    index++;
	}//end for	
	return retVal;
    }//end of get radar type
 
    public String[] getWindStringArray(){
	String[] retVal = new String[windList.size()];
	int index = 0;
	for(Wind type : windList){
	    retVal[index] = type.getName();
	    index++;
	}//end for	
	return retVal;
    }//end of get radar type
    
    public String[] getMapStringArray() {
        String[] retVal = new String[maps.size()];
        for(int i = 0; i <retVal.length; i++){
            retVal[i] = maps.get(i).name;
        }
        return retVal;
 
}
    
    /*
     public void updateAllAircraft(float timeInterval)
    {
        for(Aircraft aircraft: airCraftList)
        {
            aircraft.executeCommand("111sr345");
        }
        
        for(Aircraft aircraft: airCraftList)
        {
            aircraft.update(timeInterval);
            //System.out.println("y:" + aircraft.getAircraftState().getLocation().getY());
        }
    }
     */
    
    
    public static void main(String a[])
    {
	/*
        AircraftType aircraftType = new AircraftType("F16", 300, 1000, 2000, new AircraftTurnDegree(1.1f, 6f, 2.2f));
        AircraftState aircraftState = new AircraftState("111",new Location(40,20,10),30,500,1000);
        Aircraft aircraft = new Aircraft(aircraftState, aircraftType);
        //aircraft.executeCommand("111tr035");
        aircraft.update(10);
        aircraft.update(10); 
        aircraft.update(10);
        aircraft.update(10); 
        aircraft.update(10); 
        aircraft.update(10);
	*/
	
	
    }
     //end of game scene
}
